All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.util.List

java.lang.Object
   |
   +----sun.server.util.List

public class List
extends Object
A class that defines the list data structure.


Constructor Index

 o List()
 o List(int)

Method Index

 o delete(Object)
delete is used to delete an element from the middle of the list.
 o deleteAll()
Delete all elements of the list.
 o deleteHead()
Delete the head of the list.
 o deleteListEntry(ListEntry)
The deleteListEntry method is a fast way to delete objects from the middle of the list.
 o deleteTail()
Delete the tail of the list.
 o elements()
Return a list of elements that are on the list.
 o firstElement()
Return the first element of the list.
 o insertHead(Object)
Add an element to the head of the list.
 o insertTail(Object)
Add an element to the tail of the list.
 o lastElement()
Return the last element of the list.
 o makeFirst(ListEntry)
Move the specified ListEntry as the head of the list.
 o makeLast(ListEntry)
Move the specified ListEntry as the tail of the list.
 o size()
Return the number of elements of the list.

Constructors

 o List
 public List()
 o List
 public List(int count)

Methods

 o firstElement
 public synchronized Object firstElement()
Return the first element of the list. The list is not changed as a result of this operation

 o lastElement
 public synchronized Object lastElement()
Return the last element of the list. The list is not changed as a result of this operation

 o insertHead
 public synchronized ListEntry insertHead(Object element)
Add an element to the head of the list.

Returns:
a ListEntry object that can be later used to delete the just inserted object. This is not the same as the object inserted and is used in the deleteListEntry() method. This is used for a pure performance optimisation - delete() is an o(N) operation and deleteListEntry is o(1).
See Also:
deleteListEntry
 o insertTail
 public synchronized ListEntry insertTail(Object element)
Add an element to the tail of the list.

Returns:
a ListEntry object that can be later used to delete the just inserted object. This is not the same as the object inserted and is used in the deleteListEntry() method. This is used for a pure performance optimisation - delete() is an o(N) operation and deleteListEntry is o(1).
See Also:
deleteListEntry
 o delete
 public synchronized Object delete(Object element)
delete is used to delete an element from the middle of the list. This operation takes o(N) time. For faster deletes, deleteListEntry can be used.

Parameters:
the - element to be deleted.
Returns:
the element just deleted or null if the element to be deleted is not part of the list.
See Also:
deleteListEntry
 o deleteListEntry
 public synchronized Object deleteListEntry(ListEntry entry)
The deleteListEntry method is a fast way to delete objects from the middle of the list. For deleting from the head or tail of the list deleteHead or deleteTail can be used. The ListEntry is an opaque object returned by insertHead() or insertTail(). The deleteListEntry() is a fast way of deleting objects directly in the middle of the list without having to traverse the list. deleteListEntry() is a o(1) operation while delete() is a o(N) operation. So the application could save the ListEntry object returned by inserts for faster deletion from the middle of the list. The deleteHead() and deleteTail() methods are o(1) operations as well.

Parameters:
the - ListEntry object returned by insertHead or insertTail
Returns:
the deleted object from the list.
 o deleteHead
 public synchronized Object deleteHead()
Delete the head of the list.

Returns:
the element just deleted or null if the list is empty.
 o deleteTail
 public synchronized Object deleteTail()
Delete the tail of the list.

Returns:
the element just deleted or null if the list is empty.
 o deleteAll
 public synchronized void deleteAll()
Delete all elements of the list.

 o makeFirst
 public synchronized void makeFirst(ListEntry entry)
Move the specified ListEntry as the head of the list.

 o makeLast
 public synchronized void makeLast(ListEntry entry)
Move the specified ListEntry as the tail of the list.

 o elements
 public synchronized Enumeration elements()
Return a list of elements that are on the list.

 o size
 public synchronized int size()
Return the number of elements of the list.


All Packages  Class Hierarchy  This Package  Previous  Next  Index